﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="ArticleDetails.aspx.vb" Inherits="Testing.ArticleDetails" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        .style3
        {
            width: 60px;
            height: 38px;
        }
        .style4
        {
            width: 179px;
            height: 38px;
        }
        .style5
        {
            height: 38px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource1">
    <ItemTemplate>
    Tittle: <%# Eval("A_Name")%><br />
    Posted By : <%# Eval("UserName")%><br />
    Date : <%# Eval("A_PostDate")%><br /><br />
    <fieldset>
    Description :<div style="text-align:justify"> <%# Eval("A_Desc")%></div>
    </fieldset>
    </ItemTemplate>
    </asp:ListView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:DBConnString %>" 
        ProviderName="<%$ ConnectionStrings:DBConnString.ProviderName %>" 
        SelectCommand="SELECT [ID], [A_Name], [A_Desc], [A_PostDate], [UserName] FROM [Query_DisplayArticles] WHERE ([ID] = ?)">
        <SelectParameters>
            <asp:QueryStringParameter Name="ID" QueryStringField="ID" Type="Int32" />
        </SelectParameters>
    </asp:SqlDataSource>  
    <br />
    <fieldset>
        <table style="width: 100%;">
            <tr>
                <td style="background-color:#69E0DD" class="style3">
                    &nbsp;
                Rating :</td>
                <td align="center" bgcolor="#69E0DD" class="style4" valign="middle">
                    <asp:Label ID="lbl_r_by_u" runat="server" Font-Bold="True" Font-Size="Small" 
                        ForeColor="White"></asp:Label>
                    &nbsp;
                <asp:RadioButtonList ID="rbl_rating" runat="server" 
            RepeatDirection="Horizontal">
            <asp:ListItem>1</asp:ListItem>
            <asp:ListItem>2</asp:ListItem>
            <asp:ListItem>3</asp:ListItem>
            <asp:ListItem>4</asp:ListItem>
            <asp:ListItem>5</asp:ListItem>
        </asp:RadioButtonList>
                </td>
                <td bgcolor="#CCCCCC" class="style5">
                    &nbsp;&nbsp;&nbsp;&nbsp; Average Rating for this Article :
                    <asp:Label ID="lbl_Avg_Rating" runat="server" Font-Bold="True" 
                        ForeColor="#6600FF"></asp:Label>
                    <br />
&nbsp;&nbsp;&nbsp;&nbsp; No. of user Rating Given :
                    <asp:Label ID="lbl_rating_Users" runat="server" Font-Bold="True" 
                        ForeColor="#FF3399"></asp:Label>
                </td>
            </tr>
            <tr>
                <td class="style3">
                    &nbsp;</td>
                <td align="center" class="style4" valign="middle">
                    <asp:Button ID="btn_submit_rating" runat="server" Text="Submit Rating" />
                </td>
                <td class="style5">
                    &nbsp;</td>
            </tr>
            </table>
    &nbsp;</fieldset>
    <fieldset>
    <legend style="background-color:Gray; color: Black; font-weight:bolder;">Add Comments</legend>

        <asp:TextBox ID="txt_comment" runat="server" Height="130px" 
            TextMode="MultiLine" Width="100%"></asp:TextBox>
        <br />
        <asp:Button ID="btn_Addcomment" runat="server" Text="Add Comment" />
    </fieldset> 
    <hr />
    <fieldset>
    <legend style="background-color:Teal; color: White; font-weight:bolder;">User Comments</legend>

        <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource2">
        <ItemTemplate>
        <fieldset>
        User Name : <%# Eval("UserName")%><br />
        Commented On : <%# Eval("Comment_Date")%><br /><br />
        Comments : <div><%# Eval("Comment")%></div>

        </fieldset>        
        </ItemTemplate>
        </asp:Repeater>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
            ConnectionString="<%$ ConnectionStrings:DBConnString %>" 
            ProviderName="<%$ ConnectionStrings:DBConnString.ProviderName %>" 
            
            SelectCommand="SELECT [ID], [Article_ID], [UserID], [Comment_Date], [Comment], [UserName] FROM [Query_Diplaying_Comments] WHERE ([Article_ID] = ?) ORDER BY [ID] DESC">
            <SelectParameters>
                <asp:QueryStringParameter Name="Article_ID" QueryStringField="ID" 
                    Type="Int32" />
            </SelectParameters>
        </asp:SqlDataSource>

    </fieldset> 
</asp:Content>
